<template>
  <div>
    <el-form ref="form" v-loading="loading" :model="entity" :rules="rules" label-width="80px">
      <el-form-item label="ID" prop="id" hidden>
        <el-input v-model="entity.id" disabled></el-input>
      </el-form-item>
      <el-form-item label="用户名" prop="loginName">
        <el-input v-model="entity.loginName" class="text loginName" type="text" placeholder="用户名"/>
      </el-form-item>
      <el-form-item label="姓名" prop="nickName">
        <el-input v-model="entity.nickName" type="text" placeholder="姓名"/>
      </el-form-item>
      <el-form-item label="手机号" prop="phoneNum">
        <el-input v-model="entity.phoneNumber" type="number" placeholder="手机号"/>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="handleSave()">保存</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { mapGetters } from 'vuex';
import API from '@/api/business/user';
import { EditMethods } from '@/utils/crud';

export default {
    props: {
        id: {
            type: String,
            default: ''
        }
    },
    data: function() {
        return {
            loading: 0,
            entity: {
                id: null,
                name: null
            },
            rules: {
                name: {
                    required: true, trigger: 'blur'
                }
            }
        };
    },
    computed: {
        ...mapGetters([
            'dictionary'
        ])
    },
    created: function() {
        this.init();
    },
    methods: Object.assign(EditMethods(API), {

    })
};
</script>

<style>

</style>
